import { defineStore } from "pinia";
import { useWebSocket } from "@vueuse/core";

export const useSocketStore = defineStore({
    id: "socket",
    state: () => ({
        ws: null,
    }),
    actions: {
        //连接websocket
        connection() {
            const { status, data, send, open, close, ws } = useWebSocket(
                "ws://121.40.165.18:8800",
                // {
                //     autoReconnect: true,
                //     heartbeat: true,
                // }
            );
            this.ws = ws;
        },
    },
});
